
<p><b>syntax:</b> <i>upstream name { ... }</i>
</p><p><b>default:</b> <i>none</i>
</p><p><b>context:</b> <i>http</i>
</p><p>This directive describes a set of servers, which can be used in directives proxy_pass and fastcgi_pass as a single entity.
They can listen to server on different ports and furthermore, it is possible to simultaneously use a server that listens on both TCP and Unix sockets. 
</p><p>Servers can be assigned different weights.  If not specified weight is equal to one.
</p><p>Example configuration:
</p><p></p>
<pre class="code"><span class="kw4">upstream</span> backend <span class="br0">&#123;</span>
  <span class="kw3">server</span> backend1.example.com weight=<span class="nu0">5</span>;
  <span class="kw3">server</span> <span class="nu0">127.0</span><span class="nu0">.0</span><span class="nu0">.1</span>:<span class="nu0">8080</span>       max_fails=<span class="nu0">3</span>  fail_timeout=30s;
  <span class="kw3">server</span> unix:/tmp/backend3;
<span class="br0">&#125;</span></pre>
<p>Requests are distributed according to the servers in round-robin manner with respect of the server weight.<br />
For example of every 7 seven requests given above they will be distributed like this: 5 requests on backend1.example.com and one request to the second and the third of server. If with an attempt at the work with the server error occurred, then the request will be transmitted to the following server and then until all workers of server not are tested. If successful answer is not succeeded in obtaining from all servers, then to client will be returned the result of work with the last server.
</p>
<br><i>Module: NginxHttpUpstreamModule</i>